<include file="public:header"/>
<link rel="stylesheet" type="text/css"
      href="http://o9kxq6gms.bkt.clouddn.com/js_source/artdialog/plugins/skins/idialog.css"/>
<script type="text/javascript" charset="UTF-8"
        src="http://o9kxq6gms.bkt.clouddn.com/js_source/artdialog/artDialog.source.js.js"></script>
<script type="text/javascript" charset="UTF-8"
        src="http://o9kxq6gms.bkt.clouddn.com/js_source/artdialog/plugins/iframeTools.source.js"></script>
<style>
    .global-pages {
        float: right;
    }
</style>
<div id="bd">
    <div class="layout grid-s45m0 w1000 user-center">
        <div class="col-main">
            <div class="main-wrap">
                <div class="box J_TBox">
                    <div class="global-title">经纪人审核
                        <div class="order_search_box">
                            <form method="get" action="">
								<span class="standard_select fl">
									<span class="select_shelter">
									<select name="type" class="order_select fl" style="width:112px;">
                                        <option value="">审核状态(全部)</option>
                                        <option value="1" <if condition="$search[type] eq 1">selected</if>>未审核</option>
                                        <option value="2" <if condition="$search[type] eq 2">selected</if>>已审核</option>
                                    </select>
									</span>
								</span>
                                <input type="text" name="username" class="order_text fl" placeholder="用户名称" value="{$search[username]}">
                                <input type="text" name="tele" class="order_text fl" placeholder="请输入手机号" value="{$search[tele]}">
                                <input type="submit" class="order_sub" value="搜索"/>
                            </form>
                        </div>
                    </div>
                </div>


                <div class="box J_TBox">
                    <table cellpadding="0" cellspacing="0" class="server-content table-list"
                           style="margin-bottom:10px;">
                        <tr class="title">
                            <td align="center">ID</td>
                            <td align="center">帐号/真名</td>
                            <td align="center">总经销</td>
                            <td align="center">经销商</td>
                            <td align="center">代理商</td>
                            <td align="center">经纪人</td>
                            <td align="center">全民经纪人</td>
                            <td align="center">手机号码</td>
                            <td align="center">状态</td>
                            <td align="center">返佣比例</td>
                            <if condition="$tgroup eq 2">
                            <td align="center" width="150">操作</td>
                            </if>
                        </tr>
                        <volist name="list" id="val">
                            <tr class="list">
                                <td align="center">{$val.id}</td>
                                <td align="center">{$val.username}</td>
                                <td align="center">{$val.tgroup_1|get_username}</td>
                                <td align="center">{$val.tgroup_2|get_username}</td>
                                <td align="center">{$val.tgroup_3|get_username}</td>
                                <td align="center">{$val.tgroup_4|get_username}</td>
                                <td align="center">{$val.tgroup_5|get_username}</td>
                                <td align="center">{$val.tele}</td>
                                <td align="center">{$val.agent_status|agent}</td>
                                <td align="center">{$val.commission}%</td>
                                <if condition="$tgroup eq 2">
                                <td align="center"><a onclick="agent({$val.uid});">审核</a></td>
                                </if>


                            </tr>
                        </volist>
                    </table>
                </div>


                <div class="box J_TBox">
                    <div class="global-pages">
						<span class="num">
							{$page}
						</span>
                    </div>
                </div>
            </div>
        </div>
        <include file="user:left"/>
    </div>
</div>
<!--主部结束-->
<script type="text/javascript" src="http://o9kxq6gms.bkt.clouddn.com/jQuery/jquery-1.11.1.min.js"></script>
<script>
    function agent(id) {


        html = '<table class="table_form"width="100%"><tbody><tr><th>返佣比例：</th><td><input name="commission" id="commission"  class="input-text"  value="" size="30" type="text">%</td></tr></tbody></table>';

        var dialog = art.dialog({
            title: '经纪人审核',
            content: html,
            icon: 'succeed',
            okVal: '确定',
            cancel: true,
            ok: function () {
                var commission = document.getElementById('commission');
                if (commission.value == '') {
                    alert("请输入返佣比例");
                    return false;
                }
                if (commission.value > 2) {
                    alert("返佣比例不能超过2%");
                    return false;

                }
                var url = 'http://lv.v-town.cc/index.php/?g=team&m=user&a=agent_act';
                $.getJSON(url, {'id': id, 'commission': commission.value}, function (json) {

                            if (json.status == 1) {
                                // var status= document.getElementById('status_'+id);
                                //status.innerHTML ="已审核";
                                //$("#status_"+id).html("_blank");
                                alert(json.message);
                                $('#status_' + id).html("已审核");
                                window.location.reload();


                                return false;
                            }
                            alert(json.message);
                        }
                );
                return false;
            }
        });
    }
</script>
<include file="public:footer"/>